<%@ page import = "java.io.*" %>
<%@ page import = "java.net.*" %>
<%@ page import = "java.text.*" %>
<%@ page import = "java.util.*" %>
<%@ page import="com.mbbcpa.app.manager.*" %>
<%@ page import="com.mbbcpa.app.EncryptionHelper" %>
<%@ page import="com.mbbcpa.util.*" %>
<%@ page import="com.mydesk.app.cus.business.*" %>
<%@ page import="com.mbbcpa.app.home.*" %>

<html>
<head>
<title>MyDesk System</title>
<meta http-equiv="content-type" content="text/html;charset=utf-8"/>
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="Pragma" content="no-cache"/>
<meta http-equiv="Expires" content="-1"/>

<link rel="shortcut icon" href="favicon.ico">
<link rel="stylesheet" href="resource/mbb_sec_global.css" type="text/css" />

</head>


<%
  	System.out.println("login.jsp");

  	String strMerchant = (String) session.getAttribute(Constants.MERCHANT_KEY);

	Properties paramProp = (Properties) session.getAttribute(Constants.PROPERTIES_PARAMETER);
	// Store the parameter/config properties in session
	// sysadm/sysadm3456

	String userIdMaxLength = paramProp.getProperty(ParamHome.SEC_LOGIN_ID_MAX_LEN);
	String userPwdMaxLength = paramProp.getProperty(ParamHome.SEC_PWD_MAX_LEN);
  	System.out.println("LogIn.jsp: userIdMaxLength" + userIdMaxLength);

	String  strErrLogonMsg = (String) session.getAttribute(Constants.LOGON_ERR_MSG);
	// remove the  attribute;
	session.removeAttribute(Constants.LOGON_ERR_MSG);


	// Prevent user from invoking login.jsp directly instead of LogIn.do
	if (session.getAttribute(Constants.MERCHANT_KEY) == null )
	{
		out.println("<script> window.location=\"LogIn.do\"; </script>");

	}

%>


<script language="Javascript">
	function SubmitAction(){
		var frm = document.CheckUserLogonForm;
		cid = frm.<%=Constants.PARAM_USER_ID%>.value;
		cpwd = frm.<%=Constants.PARAM_USER_PWD%>.value;
		var invalid = " "; // Invalid character is a space
		var success = true;
		if(cid==null || cid==""){
			alert("Please Enter User Id");
			success =  false;
		}
		if(cpwd==null || cpwd==""){
			alert("Please Enter Password");
			success = false;
		}else {
			if (cpwd.length > <%=userPwdMaxLength%>){
				alert("The Password length must less than <%=userPwdMaxLength%> characters long");
				success = false;
			}
			if(cpwd.indexOf(invalid) > -1) {
				alert("Sorry, spaces are not allowed in The Password");
				success = false;
			}
		}

		if (success) {
		   frm.action="CheckUserLogon.do?dispatch=init";
		}


		//document.CheckUserLogonForm.action="CheckUserLogon.do?dispatch=init";
		//document.CheckUserLogonForm.submit();

		return success;


	}

</script>
<img id="logo" src="resource/logo-maybank.png"/>
<BR>
<BR>
<BR>
		<table align="center" border=1 width = 70%>
			<tr>
				<th class="pageTitle" colspan="2">MyDesk Console Login</th>
			</tr>
			<tr>
				<th class="header mbb_blue" colspan="2" align="left">Warning :</th>
			</tr>
			<tr class="header">
				<td colspan = "2">Use of this system is restricted to individuals and activities authorized by the management of the Bank. Unauthorized use may result in appropriate disciplinary action and/or legal prosecution.</td>
			</tr>
  	</table>
<BR>
<BR>

<BR>

	<form name="CheckUserLogonForm" method="post" onSubmit="return SubmitAction();">		
		<table align="center" border=1 width = 30%>
			<tr>
				<td>
					Login ID :<br/>

				</td>
				<td><input type="text" name="<%=Constants.PARAM_USER_ID%>" size=20 maxlength="<%=userIdMaxLength%>" autocomplete="off" value="mbbadmin"></td>
			</tr>
			<tr>
				<td>
					Password :<br/>
				</td>
				<td><input type="password" name="<%=Constants.PARAM_USER_PWD%>" size=20 maxlength="<%=userPwdMaxLength%>" autocomplete="off" value="password"></td>
			</tr>
			<tr>
				<noscript>
					<input type="hidden"  name="<%=Constants.PARAM_JS_ENABLE%>" value="no"/>

				</noscript>


				<td>&nbsp;</td>
				<td><input type="submit" value="Login"> </td>
			</tr>
  	</table>
</form>
</body>

<%@ include file="bottom.jsp" %>